using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace LoanApprovalClient
{
    public partial class AdminLogin : System.Web.UI.Page
    {
        BLApproveAdmin.BLApproveAdmin blApproveAdmin = new LoanApprovalClient.BLApproveAdmin.BLApproveAdmin();

        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            blApproveAdmin.currentPage = this.Page;
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            lblError.Visible = false ;
        }

        protected void btnSubmit_ServerClick(object sender, EventArgs e)
        {
            //Login - Check credentials
            string oSessionKey  = string.Empty;
            bool valid = blApproveAdmin.adminLogin(txtUserName.Value, txtPassword.Value, out oSessionKey);
            if (valid)
            {
                Response.Redirect("AdminApprove.aspx?s=" + oSessionKey);
            }
            else
            {
                lblError.Text = "Invalid username/password.";
                lblError.Visible = true;
            }
        }
    }
}
